/* Creation History
 * CRLOG	: CR1528
 * --------------------------------------------------------------
 * NAME   	: PasswdHistory.java
 * FUNCTION	: Password History class (for jis_s_passwd_history) 
 * BY     	: PH, HPMS
 * DATE   	: 25-JAN-2006
 *--------------------------------------------------------------
 * Modification History
 *--------------------------------------------------------------
 * 
 *--------------------------------------------------------------
*/

package admin.system.passwdhistory;

import com.ffpc.sql.*;

public class PasswdHistory extends DataObject implements PasswdHistoryBean {

  private String user_id				= null;
  private String passwd					= null;
  private String eff_date				= null;

  private Column ColUserId				= null;
  private Column ColPasswd				= null;
  private Column ColEffDate				= null;

  /**
   * Constructor
   */
  public PasswdHistory() {
	  ColUserId		= new Column(0, "user_id",	Column.Types.string, null, 10, false);
	  ColPasswd		= new Column(1, "passwd",	Column.Types.string, null, 256, false);
	  ColEffDate	= new Column(2, "eff_date",	Column.Types.time_n, null, 10, false);
  }

  @Override
public void setUSER_ID(String user) {
	  this.user_id	= this.setAttribute(ColUserId, user);
  }
  @Override
public String getUSER_ID() {
	  return this.user_id;
  }

  @Override
public void setPASSWD(String t_passwd) {
	  this.passwd = this.setAttribute(ColPasswd, t_passwd);
  }
  @Override
public String getPASSWD() {
	  return this.passwd;
  }

  @Override
public void setEFF_DATE(String tmp_date) {
    this.eff_date = this.setAttribute(ColEffDate, tmp_date);
  }
  @Override
public String getEFF_DATE() {
    return this.eff_date;
  }

  //belongs to row interface
  @Override
public Column[] createColumns() {
	  Column[] cols	= new Column[3];

	  cols[0]		= ColUserId.clone(null);
	  cols[1]		= ColPasswd.clone(null);
	  cols[2]		= ColEffDate.clone(null);

	  return cols;
  }

  //super's abstract methods
  @Override
public String getTableName() {
	  return "jis.jis_s_passwd_history";
  }

  @Override
protected String[] getKeyColumnNames() {
		String[] list		=	{
							"user_id",
							"passwd"
							};
		return list;
  }

  @Override
protected String[] getUpdatableColumnNames() {
		String[] list		= {
							"eff_date"
							};
		return list;
  }

  @Override
protected void retrieveColumnValues() {
	  this.user_id	= this.retrieveColumnValue("user_id");
	  this.passwd	= this.retrieveColumnValue("passwd");
	  this.eff_date	= this.retrieveColumnValue("eff_date");
  }

  public String printRecord() {
	  String newline	= "\n";
	  String record		= "User Id	= " + getUSER_ID() + newline;
	  record			+="Password	= " + getPASSWD()  + newline;
	  record			+="Eff Date = " + getEFF_DATE()+ newline;

	  return record;
  }

}